-
-
Notifications
You must be signed in to change notification settings - Fork 147
Type NAType
#1348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Type NAType
#1348
Conversation
@MarcoGorelli pine me when I should review |
sure @Dr-Irv , happy for you to take a look, thanks! |
…ndex` as they return `NotImplemented`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the orthogonal issue, can you add a comment in #1347 that says that this file will have to be updated as part of addressing that issue?
Otherwise looks good. Just some small stuff
# bug upstream: https://github.com/pandas-dev/pandas/issues/62196 | ||
# check( | ||
# assert_type( | ||
# divmod(na, s_int), | ||
# tuple[pd.Series, pd.Series], | ||
# ), | ||
# tuple, | ||
# ) | ||
# check( | ||
# assert_type( | ||
# divmod(na, idx_int), | ||
# tuple[pd.Index, pd.Index], | ||
# ), | ||
# tuple, | ||
# ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK to leave this in, with the #pyright: ignore
, because it works with mypy
. Then just make the comment about how pyright
has the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyright
1.1.405 should fix this, so can you try changing pyproject.toml
to use that version and see if you can put the test back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, have updated, it does indeed allow us to remove the # pyright: ignore
# assert_type(divmod(s_int, na), tuple[pd.Series, pd.Series]), | ||
# tuple, | ||
# ) | ||
# https://github.com/pandas-dev/pandas-stubs/issues/1347 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the bug upstream in pandas
, not the orthogonal issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this is both, here
# ), | ||
# tuple, | ||
# ) | ||
check(assert_type(na.__divmod__(1), tuple[NAType, NAType]), tuple) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i couldn't understand why, but this one fails if I write divmod(na, 1)
instead, with
/home/marcogorelli/pandas-stubs-dev/tests/test_natype.py:105:23 - error: No overloads for "divmod" match the provided arguments (reportCallIssue)
/home/marcogorelli/pandas-stubs-dev/tests/test_natype.py:105:23 - error: "assert_type" mismatch: expected "tuple[NAType, NAType]" but received "Unknown" (reportAssertTypeFailure)
/home/marcogorelli/pandas-stubs-dev/tests/test_natype.py:105:34 - error: Argument of type "Literal[1]" cannot be assigned to parameter "y" of type "SupportsRDivMod[_T_contra@divmod, _T_co@divmod]" in function "divmod"
"Literal[1]" is incompatible with protocol "SupportsRDivMod[NAType, _T_co@divmod]"
"__rdivmod__" is an incompatible type
Type "(value: int, /) -> tuple[int, int]" is not assignable to type "(other: _T_contra@SupportsRDivMod, /) -> _T_co@SupportsRDivMod"
Parameter 1: type "_T_contra@SupportsRDivMod" is incompatible with type "int"
"NAType" is not assignable to "int" (reportArgumentType)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New pyright
bug. microsoft/pyright#10899
Let's wait to get that resolved.
This has uncovered a couple of bugs:
so some tests have their assertions ignored for now, but i've linked to them in those places